package com.example.wuyou.juc;

import java.util.LinkedList;

public class JSThread extends  Thread{
    static int i=0;
    private static final Object lock = new Object();

    @Override
    public void run() {
        while (i<100){
            synchronized (lock){
                if(i%2==0){
                    i++;
                }else {
                    System.out.println("窗口" + getName() +"@"+i);
                    i++;
                }
            }
        }
    }
}
